import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.JLabel;
import javax.swing.border.TitledBorder;

import java.awt.Font;
import java.awt.Rectangle;
import javax.swing.JButton;


public class BuyPhotoOrSampleGUI extends JFrame
{
		
	private JTextField CCVtextField=null;
	private JTextField ExpDatetextField=null;
	private JTextField CreditCardNumbertextField=null;
	private JLabel lblCCV=null;
	private JLabel lblExpDate=null;
	private JLabel lblCreditCardNumber=null;
	private JButton CommitButton=null;
	private JPanel contentPane=null;
	
	public BuyPhotoOrSampleGUI()
	{
		super();
		
		//Buy photo Or Sample Panel
	    JPanel contentPane=new JPanel();
	    
	        contentPane.setOpaque(true);
	        contentPane.setBorder(new TitledBorder(null, "Registered Customer Credit Card Details:", TitledBorder.LEADING, TitledBorder.TOP, null, null));	
	        contentPane.setLayout(null);     
	        contentPane.add(getExpDateField());    
	        contentPane.add(getCCNumberField());	       	           
	        contentPane.add(getCCVField());
	        contentPane.add(getCreditCardNumberLabel());     
	        contentPane.add(getCCVLabel());     
	        contentPane.add(getExpDateLabel());
	        contentPane.add(geCommitButton());
	        
	        
	        
	      //Frame
	        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	        this.setTitle("Buy Photo Or Sample Window");
	        this.setContentPane(contentPane); 
		    this.setLocationRelativeTo(null); //This will center the JFrame in the middle of the screen
	        this.setLocationByPlatform(true);
	        this.setSize(415, 262);
	        this.setVisible( true ); // display frame
	
	}
	
	/**
	 * This method initializes Commit to Buy  Button	
	 */
	private JButton geCommitButton() {
		if (CommitButton == null) {
			 CommitButton = new JButton("Commit to Buy");
		     CommitButton.setBounds(138, 160, 113, 30);
			CommitButton.addActionListener(new java.awt.event.ActionListener() 
			{
				public void actionPerformed(java.awt.event.ActionEvent e) 
				{
					
				
				}
			});
		}
		return CommitButton;
	}
	
	/**
	 * This method initializes Credit Card Number Label
	 */
	private JLabel getCreditCardNumberLabel() {
		if (lblCreditCardNumber == null) {
			    lblCreditCardNumber = new JLabel("Credit Card Number:");
		        lblCreditCardNumber.setBounds(41, 54, 128, 17);
		        lblCreditCardNumber.setFont(new Font("Tahoma", Font.PLAIN, 13));
		}
		return lblCreditCardNumber;
	}
	
	/**
	 * This method initializes CCV Label
	 */
	private JLabel getCCVLabel() {
		if (lblCCV == null) {
			 lblCCV = new JLabel("CCV:");
		     lblCCV.setBounds(41, 86, 46, 14);
		     lblCCV.setFont(new Font("Tahoma", Font.PLAIN, 13));
		}
		return lblCCV;
	}
	
	/**
	 * This method initializes Expiration Date Label
	 */
	private JLabel getExpDateLabel() {
		if (lblExpDate == null) {
			 lblExpDate = new JLabel("Expriation Date:");
		        lblExpDate.setBounds(41, 117, 101, 14);
		        lblExpDate.setFont(new Font("Tahoma", Font.PLAIN, 13));
		}
		return lblExpDate;
	}
	
	
	/**
	 * This method initializes Credit Card Number Text Field	
	 */
	private JTextField getCCNumberField() {
		if (CreditCardNumbertextField == null) {
			CreditCardNumbertextField = new JTextField();
	        CreditCardNumbertextField.setBounds(177, 53, 113, 20);
	        CreditCardNumbertextField.setColumns(15);
	        CreditCardNumbertextField.addFocusListener(new java.awt.event.FocusAdapter() {
				public void focusLost(java.awt.event.FocusEvent e) {
					
				}
			});
		}
		return CreditCardNumbertextField;
	}
	
	/**
	 * This method initializes CCV Text Field	
	 */
	private JTextField getCCVField() {
		if (CCVtextField == null) {
			    CCVtextField = new JTextField();
		        CCVtextField.setBounds(177, 84, 113, 20);
		        CCVtextField.setColumns(10);
		        CCVtextField.addFocusListener(new java.awt.event.FocusAdapter() {
				public void focusLost(java.awt.event.FocusEvent e) {
					
				}
			});
		}
		return CCVtextField;
	}
	
	/**
	 * This method initializes Expiration DateText Field	
	 */
	private JTextField getExpDateField() {
		if (ExpDatetextField == null) {
			 ExpDatetextField = new JTextField();
		        ExpDatetextField.setBounds(177, 115, 113, 20);
		        ExpDatetextField.setColumns(10);
		        ExpDatetextField.addFocusListener(new java.awt.event.FocusAdapter() {
				public void focusLost(java.awt.event.FocusEvent e) {
					
				}
			});
		}
		return ExpDatetextField;
	}
}
